-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4x faster polygon compositing #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable 👍
@artemp any feedback or things you can see that could be improved? |
@springmeyer - Only calling potentially 'expensive' intersection if interior ring is not entirely within bounding box sounds good to me as I mentioned. I also believe the same logic were used already in mapnik-vector-tile/node-mapnik - I'm sure I saw similar approach already. I'll comment more if I see any possibilities for improvements. |
The one possible improvement I can suggest is that Tippecanoe's analogous check has three cases: entirely within the tile (no clipping needed), entirely outside the tile (immediately discarded), and overlapping the tile edge (needs to be clipped). If there are a lot of features that are entirely outside the clip region, it might help to add the quick-discard case here too. |
Thanks @ericfischer I don't think all these cases are tested and so I can't be sure at all whether the current behavior is correct (not buggy) or optimized for perf. So I think we should revert this work and keep in a PR until we can be sure. |
revert #91 for now / until further tested
This speeds up polygon decoding + clipping + encoding by 4x. Polygons are going to be the slowest to overzoom, so this is significant.
The speed boost comes from avoiding the allocation of intermediate vectors to store rings. Instead we collect bbox's while we decode, only clip geometries that are not fully within the target tile, and when we have results we encode them directly to the new feature.
Current
master
, fortest 11
gives:This PR gives, for
test 11
, gives:Going to ask @artemp for first PR review.
/cc @mapbox/maps-api @artemp @flippmoke @ericfischer